'use strict';
app.controller('chainWechatConfigCtrl',['$scope',function($scope){

    //查询店铺信息
        $scope.findinfo=function(){
            chainWechatConfigService.getWechatConfig($scope).then(function (result) {
                switch (result.status){
                    case 200:
                        $scope.wechat=result.data;
                        break;
                    default :
                        toaster.pop('error', "操作失败", "发生未知错误！请联系管理员");
                        break;
                }
            })
        }

        $scope.findinfo();

        $scope.editWechatConfig = function(){
            chainWechatConfigService.updateWechatConfig($scope).then(function(result){
                switch (result.status){
                    case 200:
                        toaster.pop('success', "提示", "操作成功");
                        //$state.go("app.wechatConfig");
                        break;
                    case 644:
                        toaster.pop('error', "操作失败", "该店铺已存在");
                        break;
                    default :
                        toaster.pop('error', "操作失败", "发生未知错误！请联系管理员");
                        break
                }
            });
        }
}]);